<template>
  <a-drawer
    title="条目信息"
    :maskClosable="false"
    width=650
    placement="right"
    :closable="true"
    @close="close"
    :visible="entryInfoVisiable"
    style="height: calc(100% - 55px);overflow: auto;padding-bottom: 53px;">
      <p><a-icon type="fire" />&nbsp;&nbsp;条目编号：{{entryInfoData.entryNum}}</p>
      <p><a-icon type="fire" />&nbsp;&nbsp;所属单元：{{unitName}}</p>
      <p><a-icon type="fire" />&nbsp;&nbsp;检查内容：{{entryInfoData.entryContent}}</p>
      <p><a-icon type="fire" />&nbsp;&nbsp;检查依据：{{entryInfoData.entryBasis}}</p>
      <p><a-icon type="fire" />&nbsp;&nbsp;分数：{{entryInfoData.entryScore}}</p>
      <p><a-icon type="fire" />&nbsp;&nbsp;是否否决：{{entryVeto}}</p>
      <p><a-icon type="fire" />&nbsp;&nbsp;状态：{{entryStatus}}</p>
      <p><a-icon type="clock-circle" />&nbsp;&nbsp;创建时间：{{entryInfoData.createTime}}</p>
      <p><a-icon type="clock-circle" />&nbsp;&nbsp;修改时间：{{entryInfoData.modifyTime? entryInfoData.modifyTime : '暂未修改'}}</p>
  </a-drawer>
</template>
<script>
export default {
  name: 'EntryInfo',
  props: {
    entryInfoVisiable: {
      require: true,
      default: false
    },
    entryInfoData: {
      require: true
    }
  },
  data () {
    return {
      key: +new Date(),
      loading: true,
      checkedKeys: [],
      menuTreeData: [],
      unitDate: []
    }
  },
  methods: {
    close () {
      this.$emit('close')
      this.checkedKeys = []
    }
  },
  computed: {
    entryVeto () {
      switch (this.entryInfoData.entryVeto) {
        case '0':
          return '否'
        case '1':
          return '可用'
        default:
          return this.entryInfoData.entryVeto
      }
    },
    entryStatus () {
      switch (this.entryInfoData.entryStatus) {
        case '0':
          return '过期'
        case '1':
          return '可用'
        default:
          return this.entryInfoData.entryStatus
      }
    },
    unitName () {
      for (let index = 0; index < this.unitDate.length; index++) {
        if (this.unitDate[index].unitId === this.entryInfoData.unitId) {
          return this.unitDate[index].unitName
        }
      }
      return ''
    }
  },
  watch: {
    entryInfoVisiable () {
      if (this.entryInfoVisiable) {
        this.$get('unit').then((r) => {
          this.unitDate = r.data.rows
        })
      }
    }
  }
}
</script>
